﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/AdminDefault.Master"
	AutoEventWireup="true" CodeBehind="ProCategoryList.aspx.cs" Inherits="ITViet.Web.Admin.ProCategoryList" %>

<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
	Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dxcb" %>
<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
	Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
	Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
	Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxTreeList.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
	Namespace="DevExpress.Web.ASPxTreeList" TagPrefix="dxwtl" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
	<div>
		<dxwtl:ASPxTreeList ID="tlCategory" ClientInstanceName="tlCategory" runat="server" AutoGenerateColumns="False" KeyFieldName="Id"
			ParentFieldName="ParentId" 
			oncelleditorinitialize="tlCategory_CellEditorInitialize" 
			oncustomcallback="tlCategory_CustomCallback" 
			oncustomjsproperties="tlCategory_CustomJSProperties" 
			onnodedeleting="tlCategory_NodeDeleting" 
			onnodeinserting="tlCategory_NodeInserting" 
			onnodeupdating="tlCategory_NodeUpdating" Width="100%">
			<SettingsBehavior AllowDragDrop="False" AllowSort="False" />
			<ClientSideEvents EndCallback="function(s, e) {
	tlCategory_EndCallback(s, e);
}" />
			<SettingsEditing Mode="EditFormAndDisplayNode" />
			<SettingsPager>
				<AllButton>
					<Image Height="19px" Width="28px" />
				</AllButton>
				<FirstPageButton>
					<Image Height="19px" Width="23px" />
				</FirstPageButton>
				<LastPageButton>
					<Image Height="19px" Width="23px" />
				</LastPageButton>
				<NextPageButton>
					<Image Height="19px" Width="19px" />
				</NextPageButton>
				<PrevPageButton>
					<Image Height="19px" Width="19px" />
				</PrevPageButton>
				<Summary AllPagesText="<%$Resources:Strings, PagerText %>" Text="<%$Resources:Strings, PagerText %>" />
			</SettingsPager>
			<Columns>
				<dxwtl:TreeListTextColumn Caption="<%$ Resources:Strings, Name %>" FieldName="Name"
					VisibleIndex="0">
					<HeaderStyle HorizontalAlign="Center" />
				</dxwtl:TreeListTextColumn>
				<dxwtl:TreeListTextColumn Caption="<%$ Resources:Strings, CreatedBy %>" FieldName="CreatedBy"
					VisibleIndex="1">
					<HeaderStyle HorizontalAlign="Center" />
				</dxwtl:TreeListTextColumn>
				<dxwtl:TreeListDateTimeColumn Caption="<%$ Resources:Strings, CreatedDate %>" FieldName="CreatedDate"
					VisibleIndex="2">
					<HeaderStyle HorizontalAlign="Center" />
					<CellStyle HorizontalAlign="Center">
					</CellStyle>
				</dxwtl:TreeListDateTimeColumn>
				<dxwtl:TreeListCommandColumn Caption=" " VisibleIndex="3" Width="100px" 
					ButtonType="Image" ShowNewButtonInHeader="True">
					<EditButton Visible="True">
						<Image Url="~/images/edit.png" />
					</EditButton>
					<NewButton Visible="True">
						<Image Url="~/images/add.png" />
					</NewButton>
					<DeleteButton Visible="True">
						<Image Url="~/images/delete.png" />
					</DeleteButton>
					<UpdateButton Visible="True">
						<Image Url="~/images/save.png" />
					</UpdateButton>
					<CancelButton Visible="True">
						<Image Url="~/images/undo.gif" />
					</CancelButton>
					<HeaderStyle HorizontalAlign="Center" />
					<CellStyle HorizontalAlign="Center">
					</CellStyle>
				</dxwtl:TreeListCommandColumn>
				<dxwtl:TreeListTextColumn VisibleIndex="4" Width="100px" Caption="<%$Resources:Strings,Detail %>">
					<HeaderStyle HorizontalAlign="Center" />
					<CellStyle HorizontalAlign="Center">
					</CellStyle>
					<EditFormSettings Visible="False" />
					<DataCellTemplate>
						<span><a style="cursor: pointer;" onclick="ViewDetail('<%#Eval("Id") %>')">
							<asp:Label ID="Label2" runat="server" Text="<%$Resources:Strings,ViewDetail %>"></asp:Label></a>
						</span>
					</DataCellTemplate>
				</dxwtl:TreeListTextColumn>
			</Columns>
			<SettingsText ConfirmDelete="<%$Resources:Messages,ERR0006 %>" />
		</dxwtl:ASPxTreeList>
	</div>
	<dxpc:ASPxPopupControl ID="pcLocale" ClientInstanceName="pcLocale" runat="server"
		Width="400px" Modal="true" CloseAction="CloseButton" PopupVerticalAlign="WindowCenter"
		AllowDragging="True" EnableViewState="True" PopupHorizontalAlign="WindowCenter"
		HeaderText="<%$Resources:Strings, Category %>">
		<ModalBackgroundStyle BackColor="Black">
		</ModalBackgroundStyle>
		<SizeGripImage Height="12px" Width="12px" />
		<CloseButtonImage Height="17px" Width="17px"></CloseButtonImage>
		<HeaderStyle>
			<Paddings PaddingLeft="10px" PaddingRight="6px" PaddingTop="1px" />
		</HeaderStyle>
		<ContentCollection>
			<dxpc:PopupControlContentControl>
				<table width="100%" class="CommonFont">
					<tr>
						<td>
							<asp:Literal runat="server" Text="<%$ Resources:Strings, Language %>"></asp:Literal>
						</td>
						<td>
							<dxe:ASPxComboBox ID="cbxLanguage" SelectedIndex="0" runat="server" DataSourceID="xdsLanguage"
								TextField="Value" ValueField="Id" ValueType="System.Int32" ClientInstanceName="cbxLanguage"
								Width="150px">
								<ButtonStyle Width="13px">
								</ButtonStyle>
								<ValidationSettings>
									<ErrorImage Height="14px" Url="~/App_Themes/Glass/Editors/edtError.png" Width="14px" />
									<ErrorFrameStyle ImageSpacing="4px">
										<ErrorTextPaddings PaddingLeft="4px" />
									</ErrorFrameStyle>
								</ValidationSettings>
								<ClientSideEvents SelectedIndexChanged="function(s,e){oncbxLanguage_SelectedIndexChanged(s,e)}">
								</ClientSideEvents>
							</dxe:ASPxComboBox>
						</td>
					</tr>
					<tr>
						<td>
							<asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:Strings, Name %>"></asp:Literal>
						</td>
						<td>
							<dxe:ASPxTextBox ID="txtNameLocale" ClientInstanceName="txtNameLocale" runat="server"
								Width="300px">
							</dxe:ASPxTextBox>
						</td>
					</tr>
					<tr>
						<td>
							<asp:Literal ID="Literal2" runat="server" Text="<%$ Resources:Strings, Description %>"></asp:Literal>
						</td>
						<td>
							<dxe:ASPxMemo ID="mmDescription" ClientInstanceName="mmDescription" runat="server"
								Height="71px" Width="300px">
							</dxe:ASPxMemo>
						</td>
					</tr>
					<tr>
						<td>
						</td>
						<td>
							<div style="float: left; padding: 5px 0 0">
								<dxe:ASPxButton ID="btnSaveLocale" runat="server" Text="<%$ Resources:Strings, Save %>"
									AutoPostBack="false">
									<ClientSideEvents Click="function(s,e){btnSaveLocale_Click();}" />
								</dxe:ASPxButton>
							</div>
							<div style="float: left; padding: 5px 0 0 5px;">
								<dxe:ASPxButton ID="btnCancel" runat="server" Text="<%$ Resources:Strings, Cancel %>"
									AutoPostBack="false">
									<ClientSideEvents Click="function(s,e){btnCancel_Click();}" />
								</dxe:ASPxButton>
							</div>
						</td>
					</tr>
				</table>
			</dxpc:PopupControlContentControl>
		</ContentCollection>
	</dxpc:ASPxPopupControl>
	<asp:HiddenField ID="hfCategoryId" runat="server" />
	<asp:HiddenField ID="hfLocaleId" runat="server" />
	<asp:XmlDataSource ID="xdsLanguage" runat="server" DataFile="~/App_Data/Status.xml"
		XPath="Items/LanguageDisplay/Status"></asp:XmlDataSource>
	<dxcb:ASPxCallback ID="CtrlCallback" ClientInstanceName="CtrlCallback" runat="server"
		OnCallback="CtrlCallback_Callback">
		<ClientSideEvents CallbackComplete="function(s,e){CtrlCallback_CallbackComplete(s,e);}" />
	</dxcb:ASPxCallback>

	<script type="text/javascript" language="javascript">

		function btnSaveLocale_Click() {
			CtrlCallback.SendCallback('save');
		}
		function btnCancel_Click() {
			pcLocale.Hide();
			txtNameLocale.SetText('');
			mmDescription.SetText('');
		}
		function tlCategory_EndCallback(s, e) {
			var error = tlCategory.cpInnerError;
			if (error != '') {
				alertMessage(error.split('|')[1]);
			}
			else {
				pcLocale.Hide();
			}
		}
		function ViewDetail(id) {
			document.getElementById("<%=hfCategoryId.ClientID %>").value = id;
			pcLocale.Show();
			//setTimeout("CtrlCallback.SendCallback('loadlocale')", 10);
			CtrlCallback.SendCallback('loadlocale');
		}
		function CtrlCallback_CallbackComplete(s, e) {
			//alert(e.result);
			//alert(e.result.split('|'));
			var values = e.result.split('|');
			if (values[0].indexOf('[locale]') != -1) {
				pcWaiting.Hide();
				document.getElementById("<%=hfLocaleId.ClientID %>").value = values[1];
				txtNameLocale.SetText(values[2]);
				mmDescription.SetText(values[3]);
			}
			else if (values[0].indexOf('[save]') != -1) {
				alertMessage('<%=(string)GetGlobalResourceObject("Messages","ERR0005") %>');
			}
			else if (values[0].indexOf('error') != -1) {

				alertMessage(values[1]);
			}
		}
		function oncbxLanguage_SelectedIndexChanged(s, e) {
			CtrlCallback.SendCallback('loadlocale');
		}
	</script>

</asp:Content>
